<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <title>账号中心</title>
    <link rel="stylesheet" href="${ctx}/static/plug/frozenui-1.3.0/css/frozen.css" media="all">
    <link rel="stylesheet" href="${ctx}/static/css/user/register.css" media="all">
    <style type="text/css">
        .content {
            padding-top: 10px;
            padding-left: 20px;
            padding-right: 20px
        }

        .demo-block {
            position: relative;
        }

        .demo-block .ui-header,
        .demo-block .ui-footer {
            position: absolute;
        }

        .demo-block > .ui-list, .demo-block > .ui-form, .demo-block > .ui-tooltips {
            margin-bottom: 20px;
        }

    </style>
</head>
<body>

<section class="ui-container">
    <div class="ui-flex  ui-flex-ver ui-flex-pack-center content">

        <div style="margin-top: 50px; margin-left: 10px">
            <h1>当前绑定的账号:</h1>
        </div>
        <div style="margin: 0 auto; text-align: center">
            <h1 style="font-size: 20px; color: #469fe3">
                <span>${parkingName}</span>
            </h1>
        </div>
        <div class="ui-notice-btn" style="text-align: center; padding-top: 40px">
            <p class="title" style="font-size: 14px; padding-top: 2px">
                返回公众号首页可以实时查看停车场收入流水
            </p>
            <button id="btnTx" class="ui-btn-lg  ui-btn-primary charge_button" style="border-radius: 5px;"
                    data="${userInfo.money}">解除绑定
            </button>
        </div>

    </div>
</section>
<section id="dialog">
    <div class="demo-block">
        <div class="ui-dialog ">
            <div class="ui-dialog-cnt" style="width:80%">
                <header class="ui-dialog-hd ui-border-b">
                    <h1 class="ui-icon-info"></h1>
                </header>
                <div class="ui-dialog-bd">
                    <div>解除绑定后，公众号将无法实时查看该停车场信息，确定解除绑定吗?</div>
                </div>
                <div class="ui-dialog-ft">
                    <button type="button" id="btnRemoveBind" data-role="button">确定</button>
                    <button type="button" id="btnCancel" data-role="button">取消</button>
                </div>
            </div>
        </div>
    </div>
</section>
</body>
<script src="${ctx}/static/plug/frozenui-1.3.0/lib/zepto.min.js"></script>
<script src="${ctx}/static/plug/frozenui-1.3.0/js/frozen.js"></script>
<script>
    var paramObj = {
        "unBindWxParams": "${unBindWxParams}",
        "bindWxPageParams": "${bindWxPageParams}"
    };

    $(function () {
        $("#btnTx").click(function () {
            $(".ui-dialog").addClass("show");
        });
        var canSubmit = true;
        $("#btnRemoveBind").click(function () {
            var paraObj = {
                "params": paramObj.unBindWxParams
            };
            if (canSubmit) {
                canSubmit = false;
                $.post("${action}", paraObj, function (obj) {
                    if (obj.result) {
                        showTips("info", "解除绑定成功");
                        var hrefUrl = "${action}?params=" + paramObj.bindWxPageParams;
                        window.location.href = hrefUrl;
                    } else {
                        $("#showMsgP").html("解除绑定失败，请重试");
                    }
                    canSubmit = true;
                });
            }

        });

        $("#btnCancel").click(function () {
            $(".ui-dialog").removeClass("show");
        });
    });
</script>
</html>
